#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
int countPrimes(int n)
{
    if (n < 2)
        return 0;
    int zs[n];
    int ret = 0;
    memset(zs, 0, sizeof(zs));
    for (int i = 2; i < n; i++)
    {
        if (!zs[i])
        {
            ret++;
            if ((long long)i * i < n)
            {
                for (int j = i * i; j < n; j += i)
                    zs[j] = 1;
            }
        }
    }
    return ret;
}